package cn.bdqn.dao;

import cn.bdqn.pojo.Books;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BooksMappser {

    //分页查询所有图书，按添加时间降序
    @Select("SELECT * FROM books ORDER BY createDate DESC")
    List<Books> findAll();

    //根据页面选择，实现动态条件查询，按添加时间降序
    List<Books> criteriaQuery(@Param("bookName")String bookName,
                              @Param("bookAuthor")String bookAuthor,
                              @Param("bookPublish")String bookPublish);

    //实现添加图书
    /*@Insert("insert into books(bookName,bookAuthor,bookPublish,bookPage," +
            "bookPrice) values(#{bookName},#{bookAuthor},#{bookPublish},#{bookPage},#{bookPrice})")
    int addBooks(Books books);*/

    

}
